package com.project.forlearningdemo.dao;

import com.project.forlearningdemo.pojo.Resource;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;

@Repository
@Mapper
public interface ResourceMapper {
    //搜索资源
    List<Resource> queryResource(@Param("resourceId") Integer resourceId, @Param("userId") Integer userId, @Param("title") String title, @Param("labels") List<String> labels,@Param("status")String status, @Param("isOr") Boolean isOr, @Param("orderBy") String orderBy, @Param("isDesc") Boolean isDesc, @Param("random") Boolean random);

    //删除资源
    boolean deleteResource(@Param("resourceId") Integer resourceId, @Param("userId") Integer userId, @Param("status")String status);

    //增加资源
    boolean addResource(@Param("resource") Resource resource);

    //修改资源
    boolean updateResource(@Param("resource") Resource resource);

    //增加收藏
    boolean addCollection(@Param("resourceId") Integer resourceId, @Param("userId") Integer userId);

    //删除收藏
    boolean deleteCollection(@Param("resourceId") Integer resourceId, @Param("userId") Integer userId);

    //查询收藏
    List<Resource> queryCollection(@Param("resourceId") Integer resourceId, @Param("userId") Integer userId, @Param("labels") List<String> labels);

    //增加浏览量或者收藏量
    boolean addScanNumOrCollection(@Param("resourceId")Integer resourceId, @Param("num")String num);
}